<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../resources/common.js"></script>
<script>

input = document.createElement('input');
input.type = 'time';
input.step = '60';
document.body.appendChild(input);

function testTimeRollover(key1, key2, expected) {
  test(() => {
    input.value = "00:00:00";
    input.focus();
    eventSender.keyDown(key1);
    eventSender.keyDown(key2);
    assert_equals(input.value, expected);
    input.blur();
  }, `Putting ${key1} ${key2} to the hour field should set ${expected}`);
}

testTimeRollover('0', '1', '01:00');
testTimeRollover('1', '2', '00:00');
testTimeRollover('1', '3', '13:00');
testTimeRollover('1', '9', '19:00');
// 20+ is 2:--am
testTimeRollover('2', '3', '02:03');

</script>
</body>
